<?php
	class CreateexcelController extends Yaf_Controller_Abstract{
		public function indexAction(){
			date_default_timezone_set('Asia/shanghai');
			$objExcel = new PHPExcel();
			
			// $objProps = $objExcel->getProperties();
			// $objProps->setCreator("luo");

			// $objExcel->setActiveSheetIndex(0);
			// $objActsheet = $objExcel->getActiveSheet();
			// $objActsheet->setCellValue('A1','ID');
			// $objActsheet->setCellValue('B1','HashCode');
			// $objActsheet->setCellValue('C1','ModelName');
			// $objActsheet->setCellValue('D1','IndexName');
			// $objActsheet->setCellValue('A1','zifucuanneirong');
			// $objActsheet->setCellValue('A2','26');
			// $objActsheet->setCellValue('A3',true);
			// $objActsheet->setCellValue('A4','=SUM(A2:A2)');

			//$objPhp = PHPExcel_IOFactory::load(Yaf_);
			//$objPHPExcel = PHPExcel_IOFactory::load(substr(HTML_TPL,0,-12)."/text/a.xlsx");
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment;filename="01simple.xls"');
			header('Cache-Control: max-age=0');
			// If you're serving to IE 9, then the following may be needed
			header('Cache-Control: max-age=1');

			// If you're serving to IE over SSL, then the following may be needed
			header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
			header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
			header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
			header ('Pragma: public'); // HTTP/1.0
			$outputFileName = iconv('UTF-8','gb2312',Yaf_Application::app()->getConfig()->resource->dir.'aa_'.time().'.xls');
	
			//$objWriter->save($outputFileName);
			$objWriter = PHPExcel_IOFactory::createWriter($objExcel, 'Excel5');
			$objWriter->save('php://output');
		}
	}